package com.zhudeshuai.zhudemolist.activity;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;

import com.zhudeshuai.zhudemolist.R;
import com.zhudeshuai.zhudemolist.base.BaseActivity;
import com.zhudeshuai.zhudemolist.util.ToastUtil;

public class SharedPreferenceDemo extends BaseActivity {


	private SharedPreferences sharedPreferences;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_shared_preference_demo);

		sharedPreferences = getSharedPreferences("test", MODE_PRIVATE);
	}

	public void onGet(View view) {
		String a = sharedPreferences.getString("a", "");
		ToastUtil.showToast(a);
	}

	public void onSet(View view) {
		sharedPreferences.edit().putString("a","Hello").commit();
	}
}
